algorithms for arrays of objects